{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ea79dafe-990c-4b86-a200-ebeb2f231a16",
   "metadata": {},
   "source": [
    "# 变量"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7a620b72-77d2-45d6-ba29-8784d8b443c2",
   "metadata": {},
   "source": [
    "Python 中的变量 ==不需要预先声明==，可以直接赋值。Python 支持多种数据类型，包括数字、字符串、列表、字典等。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "87a912b3-bbbc-4016-aed6-0f3a72b10755",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "a = 1   # int\n",
    "b = \"abcd\" # str\n",
    "c = []  # list\n",
    "d = {}  # dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b476bc03-7fd5-4e5e-84c3-b79fb7e194b9",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 abcd [] {}\n"
     ]
    }
   ],
   "source": [
    "print(a,b,c,d)  # 打印输出\n",
    "# ...  直接使用不用声明"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "0d3c7600-3ab3-402d-a1ff-ce64dc4c6304",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "六 = 666"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "2cdbebba-f108-4af0-8aac-0dc1fa678b27",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "666\n"
     ]
    }
   ],
   "source": [
    "print(六)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "bbe6942a-d89a-4ddb-af95-f8b558f80f9b",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['False',\n",
       " 'None',\n",
       " 'True',\n",
       " 'and',\n",
       " 'as',\n",
       " 'assert',\n",
       " 'async',\n",
       " 'await',\n",
       " 'break',\n",
       " 'class',\n",
       " 'continue',\n",
       " 'def',\n",
       " 'del',\n",
       " 'elif',\n",
       " 'else',\n",
       " 'except',\n",
       " 'finally',\n",
       " 'for',\n",
       " 'from',\n",
       " 'global',\n",
       " 'if',\n",
       " 'import',\n",
       " 'in',\n",
       " 'is',\n",
       " 'lambda',\n",
       " 'nonlocal',\n",
       " 'not',\n",
       " 'or',\n",
       " 'pass',\n",
       " 'raise',\n",
       " 'return',\n",
       " 'try',\n",
       " 'while',\n",
       " 'with',\n",
       " 'yield']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import keyword\n",
    "keyword.kwlist"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bc9d1b02-65a1-41fb-98a4-9319bf7256f3",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "6fc691a6-d7f5-40d2-853c-bc4ede7b71f7",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n多行注释   不区分单双引号 但是必须配对 【不能前面双后面单】\\n'"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 单行注释\n",
    "\n",
    "\"\"\"\n",
    "多行注释   不区分单双引号 但是必须配对 【不能前面双后面单】\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1bb6f280-9b2b-4bc8-8954-bf37d58af46a",
   "metadata": {},
   "source": [
    "**模块和包**：使用第三方的库 或者自己封装"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c78753c9-ce43-49a6-ae25-7e7066700064",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd   # 导入 pandas 库 取别名 pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65efba69-ffb7-4a5f-a6b0-4e6b3e9cfcaf",
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib import pyplot as plt #从matplotlib中 导入 pyplot库 取别名 plt"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  },
  "toc-autonumbering": false,
  "toc-showmarkdowntxt": true
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
